package com.my.app.document.model;

import com.my.annotation.Remark;
import com.my.model.Response;

import lombok.Data;

@Data
public class ApiResult {

	private String description;
	private Class dataType;
	private boolean responseBody;

	public ApiParameter getParams() {
		ApiParameter current = new ApiParameter();
		current.setClazz(dataType);
		current.setDescription(this.description);
		current.setName("返回值");
		if (!isResponseBody()) {
			return current;
		}
		
		
		ApiParameter pa = new ApiParameter();
		pa.setClazz(Response.class);
		pa.setDescription(Response.class.getAnnotation(Remark.class).value());
		pa.setName("返回值");
		
		current.setName("data");
		pa.getConfigChildren().put("data", current);
		return pa;
	}
}
